from PIL import Image
from arcface import Arcface
if __name__ == "__main__":
    model = Arcface()
    #----------------------------------------------------------------------------------------------------------#
    #   mode用于指定测试的模式：
    #   'predict'表示单张图片预测，如果想对预测过程进行修改，如保存图片，截取对象等，可以先看下方详细的注释
    #----------------------------------------------------------------------------------------------------------#
    mode = "predict"
    #-------------------------------------------------------------------------#
    if mode == "predict":
        while True:
            # input:'img/1_001.jpg'
            image_1 = input('Input image_1 filename:')
            try:
                image_1 = Image.open(image_1)
            except:
                print('Image_1 Open Error! Try again!')
                continue

            image_2 = input('Input image_2 filename:')
            try:
                image_2 = Image.open(image_2)
            except:
                print('Image_2 Open Error! Try again!')
                continue
            
            probability = model.detect_image(image_1,image_2)
            print(probability)
